Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a342d3921
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if "--completion" in known_args: | ||
| handle_completion(parser, known_args) | ||
| raise SystemExit(0) |
There was a problem hiding this comment.
Let argparse validate --completion arguments
_parse_args() manually intercepts --completion and then unconditionally exits with status 0, which bypasses argparse validation for required values and choices. As a result, openai --completion returns success with no error output, and invalid shells supplied as a separate token are not rejected by argparse, so malformed invocations can appear successful to scripts that expect non-zero exit codes for CLI usage errors.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks for catching this! You're right, the validation bypass could cause issues with malformed invocations. I'll push a fix that lets argparse validate the shell choice before handling completion.
7a342d3 to
0456b90
Compare
|
Fixed the validation issue in the latest commit. The All tests still passing. |
Problem
The OpenAI CLI lacks shell completion support, forcing users to manually type commands and flags. This degrades developer experience for frequent CLI users.
Fixes #843
Changes
--completionflag to generate completion scripts for bash, zsh, and tcshshtabshtabas optional dependency--completiongoes through argparse validation so invalid shells error correctlyTesting
Results:
Impact